//
//  LanguageResultHeaderView.swift
//  
//
//  Created by CSS on 8/18/23.
//

import UIKit

class LanguageResultHeaderView: UIView {

    @IBOutlet private weak var headerLbl: UILabel!
    
    var headerModel: LanguageSectionModel? {
        didSet {
            headerLbl.text = headerModel?.keyInHeaderView
        }
    }
    var folderStatusChangedBlock: (() -> Void)?
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        backgroundColor = .init(white: 240 / 255.0, alpha: 1.0)
    }
    
    class func defaultHeaderView() -> Self {
        guard let xibViews = Bundle.module.loadNibNamed(String(describing: self), owner: nil) else {
            return LanguageResultHeaderView() as! Self
        }
        for xibView in xibViews {
            if xibView is LanguageResultHeaderView {
                return xibView as! Self
            }
        }
        return LanguageResultHeaderView() as! Self
    }
    
    @IBAction private func folderButtonAction(_ sender: Any) {
        folderStatusChangedBlock?()
    }
    
    
}
